<?php

require_once('../Connections/petuion.php');
require('../include/simpleHeader.php');

$currentPage = $_SERVER["PHP_SELF"];

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}



$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_petuion, $petuion);
$query_Recordset1 = "SELECT * FROM pet_info";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $petuion) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false && 
        stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);

?>
<link href="../Felix_css.css" rel="stylesheet" type="text/css" />
<body topmargin="0" leftmargin="0">
<table width="777" border="0" align="left" cellpadding="0" cellspacing="0" valign="top">
  <tr>
    <td width="777" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="51" valign="top" background="../images/fen_09.gif"><table width="95%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="16">&nbsp;</td>
            </tr>
          </table>
          <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="14"><img src="../images/fen_12.gif" width="7" height="29"></td>
              <td width="405"><span class="font_16px_black_B">宠物领养</span></td>
              <td width="15">&nbsp;</td>
              <td width="299">&nbsp;</td>
              </tr>
          </table></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="1" bgcolor="#767676"></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="8"></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="font_12px_gray">
        <tr>
          <td valign="top" class="font_12px_gray">
          <table border="0" align="left" class="font_12px_gray">
        <tr>
          <td>&nbsp;</td>
          <td width="150" align="center" class="font_12px_gray_h18"><div align="center"><strong>宠物照片</strong></div></td>
          <td width="150"><div align="center"><strong>姓名</strong></div></td>
          <td width="150"><div align="center"><strong>种类</strong></div></td>
          <td width="150"><div align="center"><strong>品种</strong></div></td>
          <td width="150" align="center" class="font_12px_gray_h18"><div align="center"><strong>领养状态</strong></div></td>
          <td width="150" align="center" class="font_12px_gray_h18"><div align="center"><strong>领养日期</strong></div></td>
        </tr>
        <?php do { ?>
          <tr>
            <td height="30" valign="middle"><img src="../images/fen_15.gif" width="10" height="11">&nbsp; </td>
            <td width="150" height="30" align="center" valign="middle"><a href="322AdoptDetails.php?PAId=<?php echo $row_Recordset1['PAId']; ?>"><img src="../Common/ShowImageAdopt.php?PAId=<?php echo $row_Recordset1['PAId']; ?>&Rnd=<?php echo rand();?>" width="100" height="100" border="1"/></a><a href="312RescuePetsLostDetails.php?PId=<?php echo $row_Recordset1['PId']; ?>"></a></td>
            <td width="150"><div align="center"><?php echo $row_Recordset1['PAPetName']; ?></div></td>
            <td width="150" height="30"><div align="center"><?php echo $row_Recordset1['PType']; ?></div></td>
            <td width="150" height="30"><div align="center"><?php echo $row_Recordset1['PVariety']; ?></div></td>
            <td width="150"><div align="center"><?php echo $row_Recordset1['PIsAdopt']; ?></div></td>
            <td width="150" height="30"><div align="center"><?php echo $row_Recordset1['PADate']; ?></div></td>
          </tr>
          <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
      <tr>
        <td colspan="7">
      <table border="0" align="left" cellpadding="0" cellspacing="5" class="font_12px_gray">
            <tr>
              <td><?php /*?><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?><?php */?>
                <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">[首页]</a>
                <?php /*?><?php } // Show if not first page ?><?php */?></td>
              <td><?php /*?><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?><?php */?>
                <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">[前一页]</a>
                <?php /*?><?php } // Show if not first page ?><?php */?></td>
              <td><?php /*?><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?><?php */?>
                <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">[后一页]</a>
                <?php /*?><?php } // Show if not last page ?><?php */?></td>
              <td><?php /*?><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?><?php */?>
                <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">[末页]</a>
                <?php /*?><?php } // Show if not last page ?><?php */?></td>
              </tr>
          </table>      </td></tr>
      
      <tr><td colspan="7">
      <?php /*?><p>
          
            Records <?php echo ($startRow_Recordset1 + 1) ?> to <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> of <?php echo $totalRows_Recordset1 ?>
          </p><?php */?>
      </td></tr>
      </table>      
          
          
          </td>
        </tr>
      </table>
      
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="8"></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>

<?php
mysql_free_result($Recordset1);
?>
